using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Portal.User.Security;

using Portal.BO.Editoral.Newslist;

namespace Portal.GUI.EditoralOffice.MainOffice
{
	public partial class MainOffice : Portal.API.Module
	{
		protected void Page_Load(object sender, EventArgs e)
		{

		
			Portal.User.Security.MainSecurity ms = new Portal.User.Security.MainSecurity();
			Portal.User.Security.Permission p;
			if (Request.QueryString["cpmode"] != null)
			{
				string strMode = Request.QueryString["cpmode"].ToString();
				Control ctrNewslist;

				///*
				// * tmdung 02/04/2008 check permission
				// */ 
				//if (strMode == "permission_deny")
				//{
				//    ctrNewslist = LoadControl("Statistic/MsgPermission.ascx");
				//    plcMain.Controls.Add(ctrNewslist);
				//    goto LoadProfile;
				//}
				Session["cpmode"] = strMode;
				///********* end *************************/


				switch (strMode.ToLower())
				{
					case "add_pv":
					case "add_btv":
					case "add_tkts":
					case "add_tkm":
					case "add":



					//Control ctrNewsedit = LoadControl("Newsedit/NewsEditor.ascx");
					//plcMain.Controls.Add(ctrNewsedit);
					//break;

					case "add,templist_btv":
					case "add,templist_tkts":
					case "add,templist_tkm":
					case "add,templist_pv":
					case "add,templist":

					//ctrNewsedit = LoadControl("Newsedit/NewsEditor.ascx");
					// plcMain.Controls.Add(ctrNewsedit);
					// break;
					case "add,editwaitlist_btv":
					case "add,editwaitlist_tkts":
					case "add,editwaitlist_tkm":
					case "add,editwaitlist_pv":
					case "add,editwaitlist":
					case "add,editinglist_btv":
					case "add,editinglist_tkts":
					// ctrNewsedit = LoadControl("Newsedit/NewsEditor.ascx");
					// plcMain.Controls.Add(ctrNewsedit);
					//break;

					case "add,removedlist_tkts":
					case "add,removedlist_tkm":
					case "add,removedlist_btv":
					case "add,removedlist_pv":
					// ctrNewsedit = LoadControl("Newsedit/NewsEditor.ascx");
					// plcMain.Controls.Add(ctrNewsedit);
					// break;
					/*case "add,editwaitlist_btv":
					case "add,editwaitlist_tkts":
					case "add,editwaitlist_tkm":
					case "add,editwaitlist":
						ctrNewsedit = LoadControl("Newsedit/NewsEditor.ascx");
						plcMain.Controls.Add(ctrNewsedit);
						break;*/
					case "add,backlist_btv":
					case "add,backlist_tkts":
					case "add,backlist_tkm":
					case "add,backlist_pv":
					case "add,backlist":
					// ctrNewsedit = LoadControl("Newsedit/NewsEditor.ascx");
					// plcMain.Controls.Add(ctrNewsedit);
					// break;
					case "add,approvalwaitlist_btv":
					case "add,approvalwaitlist_tkts":
					case "add,approvalwaitlist_tkm":
					case "add,approvalwaitlist_pv":
					case "add,approvalwaitlist":
					// ctrNewsedit = LoadControl("Newsedit/NewsEditor.ascx");
					// plcMain.Controls.Add(ctrNewsedit);
					// break;
					case "add,approvinglist_btv":
					case "add,approvinglist_tkts":
					case "add,approvinglist_tkm":
					case "add,approvinglist_pv":
					case "add,approvinglist":
					// ctrNewsedit = LoadControl("Newsedit/NewsEditor.ascx");
					// plcMain.Controls.Add(ctrNewsedit);
					// break;
					case "add,dellist_btv":
					case "add,dellist_tkts":
					case "add,dellist_tkm":
					case "add,dellist_pv":
					case "add,dellist":
					// ctrNewsedit = LoadControl("Newsedit/NewsEditor.ascx");
					// plcMain.Controls.Add(ctrNewsedit);
					// break;
					case "add,publishedlist_btv":
					case "add,publishedlist_tkts":
					case "add,publishedlist_tkm":
					case "add,publishedlist_pv":
					case "add,publishedlist":
					case "add,sendlist_pv":
                    case "add,publishbycat":
						//if (NewslistHelper.CheckRolePermission(strMode))
						//{
							//Control ctrNewsedit = LoadControl("Newsedit/NewsEditor.ascx");
							Control ctrNewsedit = LoadControl("editnews/editnews.ascx");
							plcMain.Controls.Add(ctrNewsedit);
						//}
                        //else
                        //{
                        //    ctrNewslist = LoadControl("Statistic/MsgPermission.ascx");
                        //    plcMain.Controls.Add(ctrNewslist);
                        //}
						break;

					// Edit by Tqdat
					// Them cac dg link moi
					case "templist_btv":
					case "templist_tkts":
					case "templist_tkm":
					case "templist_pv":
					case "templist":
					// ctrNewslist = LoadControl("Newslist/Newslist.ascx");
					// plcMain.Controls.Add(ctrNewslist);
					// break;
					case "sendlist_btv":
					case "sendlist_tkts":
					case "sendlist_tkm":
					case "sendlist_pv":
					case "sendlist":
					// ctrNewslist = LoadControl("Newslist/Newslist.ascx");
					// plcMain.Controls.Add(ctrNewslist);
					// break;
					case "sendapprovallist_btv":
					case "sendapprovallist":
					case "sendapprovallist_tkts":
					case "sendapprovallist_tkm":
					// ctrNewslist = LoadControl("Newslist/Newslist.ascx");
					// plcMain.Controls.Add(ctrNewslist);
					// break;
					case "editwaitlist_btv":
					case "editwaitlist_tkts":
					case "editwaitlist_tkm":
					case "editwaitlist_pv":
					case "editwaitlist":
					// ctrNewslist = LoadControl("Newslist/Newslist.ascx");
					// plcMain.Controls.Add(ctrNewslist);
					// break;
					//danh sach tin cho duyet
					case "approvalwaitlist_btv":
					case "approvalwaitlist_tkts":
					case "approvalwaitlist_tkm":
					case "approvalwaitlist_pv":
					case "approvalwaitlist":
					// ctrNewslist = LoadControl("Newslist/Newslist.ascx");
					// plcMain.Controls.Add(ctrNewslist);
					// break;
					case "editinglist_btv":
					case "editinglist_tkts":
					case "editinglist_tkm":
					case "editinglist_pv":
					case "editinglist":
					// ctrNewslist = LoadControl("Newslist/Newslist.ascx");
					// plcMain.Controls.Add(ctrNewslist);
					// break;
					case "approvinglist_btv":
					case "approvinglist_tkts":
					case "approvinglist_tkm":
					case "approvinglist_pv":
					case "approvinglist":
					// ctrNewslist = LoadControl("Newslist/Newslist.ascx");
					// plcMain.Controls.Add(ctrNewslist);
					// break;
					case "backlist_btv":
					case "backlist_tkts":
					case "backlist_tkm":
					case "backlist_pv":
					case "backlist":
					// ctrNewslist = LoadControl("Newslist/Newslist.ascx");
					// plcMain.Controls.Add(ctrNewslist);
					// break;
					case "publishedlist_btv":
					case "publishedlist_tkts":
					case "publishedlist_tkm":
					case "publishedlist_pv":
					case "publishedlist":
					// ctrNewslist = LoadControl("Newslist/Newslist.ascx");
					// plcMain.Controls.Add(ctrNewslist);
					// break;
					case "unpublistlist_btv":
					case "unpublistlist_tkts":
					case "unpublistlist_tkm":
					case "unpublistlist_pv":
					case "unpublistlist":
					// ctrNewslist = LoadControl("Newslist/Newslist.ascx");
					// plcMain.Controls.Add(ctrNewslist);
					// break;
					case "dellist_btv":
					case "dellist_tkts":
					case "dellist_tkm":
					case "dellist_pv":
					case "dellist":
					// ctrNewslist = LoadControl("Newslist/Newslist.ascx");
					// plcMain.Controls.Add(ctrNewslist);
					// break;
					case "removedlist_tkm":
					case "removedlist_tkts":
					case "removedlist_btv":
					case "removedlist_pv":
					// ctrNewslist = LoadControl("Newslist/Newslist.ascx");
					// plcMain.Controls.Add(ctrNewslist);
					// break;
					case "sendeditlist_btv":
					case "sendeditlist_pv":
					case "sendeditlist_tkts":
					case "sendeditlist_tkm":
						//if (NewslistHelper.CheckRolePermission(strMode))
						//{
							ctrNewslist = LoadControl("Newslist/Newslist.ascx");
							plcMain.Controls.Add(ctrNewslist);
                        //}
                        //else
                        //{
                        //    ctrNewslist = LoadControl("Statistic/MsgPermission.ascx");
                        //    plcMain.Controls.Add(ctrNewslist);
                        //}
						break;
					case "threadsmgr":
						p = ms.GetPermission(HttpContext.Current.User.Identity.Name);
						if (p.isQuan_Ly_Luong_Su_Kien)
						{
							ctrNewslist = LoadControl("NewsThread/ThreadList.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
						else
						{
							ctrNewslist = LoadControl("Statistic/MsgPermission.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
						break;
					case "threaddetails":
						p = ms.GetPermission(HttpContext.Current.User.Identity.Name);
						if (p.isQuan_Ly_Luong_Su_Kien)
						{
							ctrNewslist = LoadControl("NewsThread/Threaddetails.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
						else
						{
							ctrNewslist = LoadControl("Statistic/MsgPermission.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
						break;
					case "mediamngr":
						p = ms.GetPermission(HttpContext.Current.User.Identity.Name);
						if (p.isQuan_Ly_Media)
						{
							ctrNewslist = LoadControl("Media/ListFile.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
						else
						{
							ctrNewslist = LoadControl("Statistic/MsgPermission.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
						break;
					case "voteadd":
						p = ms.GetPermission(HttpContext.Current.User.Identity.Name);
						if (p.isQuan_Ly_Binh_Chon)
						{
							ctrNewslist = LoadControl("VoteEdit/VoteEdit.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
						else
						{
							ctrNewslist = LoadControl("Statistic/MsgPermission.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
						break;
					case "votemngr":
						p = ms.GetPermission(HttpContext.Current.User.Identity.Name);
						if (p.isQuan_Ly_Binh_Chon)
						{
							ctrNewslist = LoadControl("VoteEdit/VoteList.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
						else
						{
							ctrNewslist = LoadControl("Statistic/MsgPermission.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
						break;
					case "voteitem":
						p = ms.GetPermission(HttpContext.Current.User.Identity.Name);
						if (p.isQuan_Ly_Binh_Chon)
						{
							ctrNewslist = LoadControl("VoteEdit/VoteItem.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
						else
						{
							ctrNewslist = LoadControl("Statistic/MsgPermission.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
						break;


					case "statistics":
						//Load control thong ke                        
						p = ms.GetPermission(HttpContext.Current.User.Identity.Name);
						if (p.isThong_Ke_Toan_Trang)
						{
							//ctrNewslist = LoadControl("Statistic/statistic.ascx");
							//plcMain.Controls.Add(ctrNewslist);
						}
						else
						{
							ctrNewslist = LoadControl("Statistic/MsgPermission.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
						break;
					case "statcontent":
						//Load control thong ke theo content
						p = ms.GetPermission(HttpContext.Current.User.Identity.Name);
						if (p.isThong_Ke_Bai_Viet)
						{
							ctrNewslist = LoadControl("Statistic/StatContent.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
						else
						{
							ctrNewslist = LoadControl("Statistic/MsgPermission.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
						break;
					case "statcategory":
						//Load control thong ke theo category                        
						p = ms.GetPermission(HttpContext.Current.User.Identity.Name);
						if (p.isThong_Ke_Chuyen_Muc)
						{
							ctrNewslist = LoadControl("Statistic/StatCategory.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
						else
						{
							ctrNewslist = LoadControl("Statistic/MsgPermission.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
						break;

					case "statpostcontent":
						//Load control thong ke theo user                        
						p = ms.GetPermission(HttpContext.Current.User.Identity.Name);
						if (p.isThong_Ke_Theo_User)
						{
							ctrNewslist = LoadControl("Statistic/StatPostContentByUser.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
						else
						{
							ctrNewslist = LoadControl("Statistic/MsgPermission.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
						break;




					case "profile":
						ctrNewslist = LoadControl("AccountProfile/profile.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
					case "commentmngr":
						ctrNewslist = LoadControl("CommentManagement/CommentManagement.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
					case "add,commentmngr":
						ctrNewslist = LoadControl("CommentManagement/CommentEdit.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
					case "listvotes":
						ctrNewslist = LoadControl("TopVoteManagement/listVotes.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
					case "listcomment":
						ctrNewslist = LoadControl("CommentManagement/ListComment.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
					case "listfashio_ncomment":
						ctrNewslist = LoadControl("FashionComment/ListFashionComment.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
					case "fashio_ncomment":
						ctrNewslist = LoadControl("FashionComment/ListComment.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
					case "add,fashio_ncomment":
						ctrNewslist = LoadControl("FashionComment/FashionCommentEdit.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
					case "newsmode":
						ctrNewslist = LoadControl("NewsModeManagement/news_mode_list.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
					case "log_users":
						p = ms.GetPermission(HttpContext.Current.User.Identity.Name);
						if (p.isXem_Log)
						{
							ctrNewslist = LoadControl("LogAction/LogAction.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
						else
						{
							ctrNewslist = LoadControl("Statistic/MsgPermission.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
						break;
					case "lognewslist":
						ctrNewslist = LoadControl("LogNewsList/LogNewsList.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;


					case "photocatlist":
						p = ms.GetPermission(HttpContext.Current.User.Identity.Name);
						if (p.isQuan_Ly_Loai_Tin_Anh)
						{
							ctrNewslist = LoadControl("PhotoCat/PhotoCatList.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
						else
						{
							ctrNewslist = LoadControl("Statistic/MsgPermission.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
						break;
					case "photocatedit":
						p = ms.GetPermission(HttpContext.Current.User.Identity.Name);
						if (p.isQuan_Ly_Loai_Tin_Anh)
						{
							ctrNewslist = LoadControl("PhotoCat/PhotoCatEdit.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
						else
						{
							ctrNewslist = LoadControl("Statistic/MsgPermission.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
						break;

					//PhotoAlbumEdit
					case "album_add_btv":
					case "album_add_pv":
					case "album_add_tkts":
					case "album_add_tkm":

					case "add,album_templist_btv":
					case "add,album_templist_tkts":
					case "add,album_templist_tkm":
					case "add,album_templist_pv":
					case "add,album_templist":

					case "add,album_editwaitlist_btv":
					case "add,album_editwaitlist_tkts":
					case "add,album_editwaitlist_tkm":
					case "add,album_editwaitlist_pv":
					case "add,album_editwaitlist":

					case "add,album_editinglist_btv":
					case "add,album_editinglist_tkts":
					case "add,album_editinglist_pv":
					case "add,album_editinglist_tkm":

					case "add,album_removedlist_tkts":
					case "add,album_removedlist_tkm":

					case "add,album_backlist_btv":
					case "add,album_backlist_tkts":
					case "add,album_backlist_tkm":
					case "add,album_backlist_pv":
					case "add,album_backlist":

					case "add,album_approvalwaitlist_btv":
					case "add,album_approvalwaitlist_tkts":
					case "add,album_approvalwaitlist_tkm":
					case "add,album_approvalwaitlist_pv":
					case "add,album_approvalwaitlist":

					case "add,album_approvinglist_btv":
					case "add,album_approvinglist_tkts":
					case "add,album_approvinglist_tkm":
					case "add,album_approvinglist_pv":
					case "add,album_approvinglist":

					case "add,album_dellist_btv":
					case "add,album_dellist_tkts":
					case "add,album_dellist_tkm":
					case "add,album_dellist_pv":
					case "add,album_dellist":

					case "add,album_publishedlist_btv":
					case "add,album_publishedlist_tkts":
					case "add,album_publishedlist_tkm":
					case "add,album_publishedlist_pv":
					case "add,album_publishedlist":
					case "add,album_sendlist_pv":
                        /*
						if (PhotoAlbumHelper.CheckRolePermission(strMode))
						{
							ctrNewslist = LoadControl("PhotoAlbum/PhotoAlbumEdit.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
						else
						{
							ctrNewslist = LoadControl("Statistic/MsgPermission.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
                        */
						break;
					//PhotoAlbumEdit
					//PhotoAlbumList
					case "photoalbumlist":
					case "album_templist_btv":
					case "album_templist_tkts":
					case "album_templist_tkm":
					case "album_templist_pv":
					case "album_templist":

					case "album_sendlist_btv":
					case "album_sendlist_tkts":
					case "album_sendlist_tkm":
					case "album_sendlist_pv":
					case "album_sendlist":

					case "album_sendapprovallist_btv":
					case "album_sendapprovallist":

					case "album_editwaitlist_btv":
					case "album_editwaitlist_tkts":
					case "album_editwaitlist_tkm":
					case "album_editwaitlist_pv":
					case "album_editwaitlist":

					case "album_approvalwaitlist_btv":
					case "album_approvalwaitlist_tkts":
					case "album_approvalwaitlist_tkm":
					case "album_approvalwaitlist_pv":
					case "album_approvalwaitlist":

					case "album_editinglist_btv":
					case "album_editinglist_tkts":
					case "album_editinglist_tkm":
					case "album_editinglist_pv":
					case "album_editinglist":

					case "album_approvinglist_btv":
					case "album_approvinglist_tkts":
					case "album_approvinglist_tkm":
					case "album_approvinglist_pv":
					case "album_approvinglist":

					case "album_backlist_btv":
					case "album_backlist_tkts":
					case "album_backlist_tkm":
					case "album_backlist_pv":
					case "album_backlist":

					case "album_publishedlist_btv":
					case "album_publishedlist_tkts":
					case "album_publishedlist_tkm":
					case "album_publishedlist_pv":
					case "album_publishedlist":

					case "album_unpublistlist_btv":
					case "album_unpublistlist_tkts":
					case "album_unpublistlist_tkm":
					case "album_unpublistlist_pv":
					case "album_unpublistlist":


					case "album_dellist_btv":
					case "album_dellist_tkts":
					case "album_dellist_tkm":
					case "album_dellist_pv":
					case "album_dellist":

					case "album_removedlist_tkm":
					case "album_removedlist_tkts":
					case "album_removedlist_btv":
					case "album_removedlist_pv":

					case "album_sendeditlist_btv":
                        /*
						if (PhotoAlbumHelper.CheckRolePermission(strMode))
						{
							ctrNewslist = LoadControl("PhotoAlbum/PhotoAlbumList.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
						else
						{
							ctrNewslist = LoadControl("Statistic/MsgPermission.ascx");
							plcMain.Controls.Add(ctrNewslist);
						}
                        */
						break;
					//PhotoAlbumList
					case "photodetailedit":
						ctrNewslist = LoadControl("PhotoAlbum/PhotoDetailEdit.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
					case "photodetaillist":
						ctrNewslist = LoadControl("PhotoAlbum/PhotoDetailList.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
					case "photodetailupload":
						ctrNewslist = LoadControl("PhotoAlbum/PhotoDetailUpload.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
					case "comment_media":
						ctrNewslist = LoadControl("CommentPhoto/PhotoDetailHasComment.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
					case "commentmedialist":
						ctrNewslist = LoadControl("CommentPhoto/ListComment.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
					case "listcrawler":
						ctrNewslist = LoadControl("ListCrawler/ListCrawler.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
					case "add,listcrawler":
						ctrNewslist = LoadControl("ListCrawler/EditCrawler.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
					case "question":
						ctrNewslist = LoadControl("Question/ListQuestion.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
					case "editquestion":
						ctrNewslist = LoadControl("Question/EditQuestion.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
					case "answer":
						ctrNewslist = LoadControl("Question/ListAnswer.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
					case "editanswer":
						ctrNewslist = LoadControl("Question/EditAnswer.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
					case "newsthreadfamily":
						ctrNewslist = LoadControl("NewsThread/ThreadEdit.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
					case "listthreadfamily":
						ctrNewslist = LoadControl("NewsThread/ThreadListFamily.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
					case "menu":
						ctrNewslist = LoadControl("ThucDon/ThucDon.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
					case "postlist":
					case "listnews":
						ctrNewslist = LoadControl("BanDocViet/ListNews.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
					case "editpost":
					case "edit_newsfeedbackpublished":
						ctrNewslist = LoadControl("BanDocViet/NewsEditor.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
					case "feedbacklist":
						ctrNewslist = LoadControl("BanDocViet/ListNewsFeedBack.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
					case "list_news_feedback":
						ctrNewslist = LoadControl("BanDocViet/ListFeedBack.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
					case "list_newsfeedbackpublished":
						ctrNewslist = LoadControl("BanDocViet/ListNewsFeedBackPublished.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
                    case "quanlytopnoibat":
                        ctrNewslist = LoadControl("QuanLyTopNew/QuanLyTopNew.ascx");
                        plcMain.Controls.Add(ctrNewslist);
                        break;
                    case "users":
                        ctrNewslist = LoadControl("Users/ListUsers.ascx");
                        plcMain.Controls.Add(ctrNewslist);
                        break;
                    case "rules":
                        ctrNewslist = LoadControl("Rules/RuleList.ascx");
                        plcMain.Controls.Add(ctrNewslist);
                        break;
                    case "code":
                        ctrNewslist = LoadControl("Code/ListCode.ascx");
                        plcMain.Controls.Add(ctrNewslist);
                        break;
                    case "commentthaoluan":
                        ctrNewslist = LoadControl("CommentThaoLuan/CommentManagement.ascx");
                        plcMain.Controls.Add(ctrNewslist);
                        break;
                    case "listcommentthaoluan":
                        ctrNewslist = LoadControl("CommentThaoLuan/ListComment.ascx");
                        plcMain.Controls.Add(ctrNewslist);
                        break;
                    case "editcommentthaoluan":
                        ctrNewslist = LoadControl("CommentThaoLuan/CommentEdit.ascx");
                        plcMain.Controls.Add(ctrNewslist);
                        break;
                    case "photouserlist":
                        ctrNewslist = LoadControl("PhotoAlbum/PhotoUserList.ascx");
                        plcMain.Controls.Add(ctrNewslist);
                        break;
                    case "photouseredit":
                        ctrNewslist = LoadControl("PhotoAlbum/PhotoUser.ascx");
                        plcMain.Controls.Add(ctrNewslist);
                        break;
                    case "thaoluannoibat":
                        ctrNewslist = LoadControl("BaiThaoLuanNoiBat/FeedBackOnHomepage.ascx");
                        plcMain.Controls.Add(ctrNewslist);
                        break;   
					default:
						ctrNewslist = LoadControl("OnLoad/onload.ascx");
						plcMain.Controls.Add(ctrNewslist);
						break;
				}
			}

			LoadProfile();
		}
		private void LoadProfile()
		{
			MainSecurity objSecu = new MainSecurity();
			Role objPermis = objSecu.GetRole(Page.User.Identity.Name, Portal.API.Config.CurrentChannel);

			Control c;

            if (objPermis.isThuKyToaSoan || objPermis.isTongBienTap || objPermis.isPhuTrachKenh)
			{
				c = LoadControl("Menu/MnuEditor.ascx");
				plcProfile.Controls.Add(c);
			}

            if (objPermis.isThuKyChuyenMuc || objPermis.isTongBienTap || objPermis.isPhuTrachKenh)
			{
				c = LoadControl("Menu/MnuSEditor.ascx");
				plcProfile.Controls.Add(c);
			}

			if (objPermis.isBienTapVien || objPermis.isTongBienTap || objPermis.isPhuTrachKenh)
			{
				// tr_btv.Visible = true;
				// tr_btv1.Visible = true;
				// tr_btv2.Visible = true;
				// box_btv.Attributes.Remove("class");
				// box_btv.Attributes.Add("class", "Menuleft_ContentBox");

				c = LoadControl("Menu/MnuBtv.ascx");
				plcProfile.Controls.Add(c);
			}

			if (objPermis.isPhongVien)
			{
				//tr_pv.Visible = true;
				//tr_pv1.Visible = true;
				//tr_pv2.Visible = true;
				//box_pv.Attributes.Remove("class");
				//box_pv.Attributes.Add("class", "Menuleft_ContentBox");
				c = LoadControl("Menu/Menu.ascx");
				plcProfile.Controls.Add(c);
			}

			if (objPermis.isThuKyToaSoan || objPermis.isTongBienTap || objPermis.isPhuTrachKenh)
			{
				//tr_tkts.Visible = true;
				//tr_tkts1.Visible = true;
				//tr_tkts2.Visible = true;
				//box_tkts.Attributes.Remove("class");
				//box_tkts.Attributes.Add("class", "Menuleft_ContentBox");
			}
			//if (objPermis.isPhongVien || objPermis.isTongBienTap)
			//{
			//    tr_pv.Visible = true;
			//    tr_pv1.Visible = true;
			//    tr_pv2.Visible = true;
			//    box_pv.Attributes.Remove("class");
			//    box_pv.Attributes.Add("class", "Menuleft_ContentBox");
			//}



            if (objPermis.isThuKyChuyenMuc || objPermis.isTongBienTap || objPermis.isPhuTrachKenh || objPermis.isThuKyToaSoan)
            {
                //c = LoadControl("Menu/MnuStatistic.ascx");
                //plcProfile.Controls.Add(c);
            }

			c = LoadControl("Menu/ProfileMenu.ascx");
			plcProfile.Controls.Add(c);
			if (objPermis.isThuKyChuyenMuc || objPermis.isTongBienTap || objPermis.isPhuTrachKenh)
			{
				// tr_tkm.Visible = true;
				// tr_tkm1.Visible = true;
				// tr_tkm2.Visible = true;
				// box_tkm.Attributes.Remove("class");
				// box_tkm.Attributes.Add("class", "Menuleft_ContentBox");
			}

			if (objPermis.isThuKyChuyenMuc || objPermis.isTongBienTap || objPermis.isPhuTrachKenh || objPermis.isBienTapVien || objPermis.isThuKyToaSoan)
			{
				// tr_qlstat.Visible = true;
				// tr_qlstat1.Visible = true;
				// tr_qlstat2.Visible = true;


			}

			#region Check ProFile Menu
			/*if (objPermis.isPhuTrachKenh)
            {
                tblMain.Rows[0].Visible = false;
                tblMain.Rows[1].Visible = false;
                tblMain.Rows[2].Visible = false;

                tblMain.Rows[3].Visible = false;
                tblMain.Rows[4].Visible = false;
                tblMain.Rows[5].Visible = false;

                tblMain.Rows[6].Visible = false;
                tblMain.Rows[7].Visible = false;
                tblMain.Rows[8].Visible = false;

                tblMain.Rows[9].Visible = false;
                tblMain.Rows[10].Visible = false;
                tblMain.Rows[11].Visible = false;

                tblMain.Rows[12].Visible = true;
                tblMain.Rows[13].Visible = true;
                tblMain.Rows[14].Visible = true;

                tblMain.Rows[13].Cells[0].Attributes.Remove("class");
                tblMain.Rows[13].Cells[0].Attributes.Add("class", "Menuleft_ContentBox");
            }
            if (objPermis.isThuKyToaSoan)
            {
                tblMain.Rows[0].Visible = false;
                tblMain.Rows[1].Visible = false;
                tblMain.Rows[2].Visible = false;

                tblMain.Rows[3].Visible = false;
                tblMain.Rows[4].Visible = false;
                tblMain.Rows[5].Visible = false;

                tblMain.Rows[6].Visible = false;
                tblMain.Rows[7].Visible = false;
                tblMain.Rows[8].Visible = false;

                tblMain.Rows[9].Visible = true;
                tblMain.Rows[10].Visible = true;
                tblMain.Rows[11].Visible = true;

                tblMain.Rows[12].Visible = false;
                tblMain.Rows[13].Visible = false;
                tblMain.Rows[14].Visible = false;

                tblMain.Rows[10].Cells[0].Attributes.Remove("class");
                tblMain.Rows[10].Cells[0].Attributes.Add("class", "Menuleft_ContentBox");
            }
            if (objPermis.isThuKyChuyenMuc)
            {
                tblMain.Rows[0].Visible = false;
                tblMain.Rows[1].Visible = false;
                tblMain.Rows[2].Visible = false;

                tblMain.Rows[3].Visible = false;
                tblMain.Rows[4].Visible = false;
                tblMain.Rows[5].Visible = false;

                tblMain.Rows[6].Visible = true;
                tblMain.Rows[7].Visible = true;
                tblMain.Rows[8].Visible = true;

                tblMain.Rows[9].Visible = false;
                tblMain.Rows[10].Visible = false;
                tblMain.Rows[11].Visible = false;

                tblMain.Rows[12].Visible = false;
                tblMain.Rows[13].Visible = false;
                tblMain.Rows[14].Visible = false;

                tblMain.Rows[7].Cells[0].Attributes.Remove("class");
                tblMain.Rows[7].Cells[0].Attributes.Add("class", "Menuleft_ContentBox");
            }
            if (objPermis.isBienTapVien)
            {
                tblMain.Rows[0].Visible = false;
                tblMain.Rows[1].Visible = false;
                tblMain.Rows[2].Visible = false;

                tblMain.Rows[3].Visible = true;
                tblMain.Rows[4].Visible = true;
                tblMain.Rows[5].Visible = true;

                tblMain.Rows[6].Visible = false;
                tblMain.Rows[7].Visible = false;
                tblMain.Rows[8].Visible = false;

                tblMain.Rows[9].Visible = false;
                tblMain.Rows[10].Visible = false;
                tblMain.Rows[11].Visible = false;

                tblMain.Rows[12].Visible = false;
                tblMain.Rows[13].Visible = false;
                tblMain.Rows[14].Visible = false;

                tblMain.Rows[4].Cells[0].Attributes.Remove("class");
                tblMain.Rows[4].Cells[0].Attributes.Add("class", "Menuleft_ContentBox");
            }
            if (objPermis.isPhongVien)
            {
                tblMain.Rows[0].Visible = true;
                tblMain.Rows[1].Visible = true;
                tblMain.Rows[2].Visible = true;

                tblMain.Rows[3].Visible = false;
                tblMain.Rows[4].Visible = false;
                tblMain.Rows[5].Visible = false;

                tblMain.Rows[6].Visible = false;
                tblMain.Rows[7].Visible = false;
                tblMain.Rows[8].Visible = false;

                tblMain.Rows[9].Visible = false;
                tblMain.Rows[10].Visible = false;
                tblMain.Rows[11].Visible = false;

                tblMain.Rows[12].Visible = false;
                tblMain.Rows[13].Visible = false;
                tblMain.Rows[14].Visible = false;

                tblMain.Rows[1].Cells[0].Attributes.Remove("class");
                tblMain.Rows[1].Cells[0].Attributes.Add("class", "Menuleft_ContentBox");
            }*/
			#endregion
		}
	}
}